import { ref } from "vue";
import axios from "axios";


const getPosts = ()=>{
    const posts = ref([]);
    const load = async () => {
  
        try {
          const { data } = await axios("http://localhost:3000/posts");
          posts.value = data;
          console.log("axios请求的数据:", data);
        } catch (error) {
          console.log(error);
        }
      };
      load();

      return { posts }
}





export default getPosts